package com.example.mydemo.utils;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class DBOpenHelper extends SQLiteOpenHelper
{
    private static final int VERSION = 1;
    public DBOpenHelper(Context context)
    {
        super(context, "vsunft.db", null, VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db)  //onCreate run only when db was create
    {     
    /** TEST_RESULT 0  not test yet
     *  			1  pass
     * 				2  fail
     * **/
        /// create item test result table
        db.execSQL("create table if not exists " + DatabaseTools.Db_ItTableName + " (_id integer primary key," +
                         DatabaseTools.Db_Title + " text,"+
                         DatabaseTools.Db_Result + " integer" +
                 ");"
                );
        /// create full test result table		
        //db.execSQL("create table if not exists " + DatabaseTools.Db_FtTableName + " (_id integer primary key," +
        //                 DatabaseTools.Db_Title + " text,"+
        //                 DatabaseTools.Db_Result + " integer" +
        //         ");"
        //        );
        ///  create pcba test result table
        //db.execSQL("create table if not exists " + DatabaseTools.Db_PtTableName + " (_id integer primary key," +
        //                 DatabaseTools.Db_Title + " text,"+
        //                 DatabaseTools.Db_Result + " integer" +
        //         ");"
        //        );		
                
        /// create pcba test result table
    }
    
     @Override
    public synchronized SQLiteDatabase getReadableDatabase() {
        // TODO Auto-generated method stub
        return super.getReadableDatabase();
    }

    @Override
    public synchronized SQLiteDatabase getWritableDatabase() {
        // TODO Auto-generated method stub
        return super.getWritableDatabase();
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
    {
        Log.i("DBOpenHlper", "UpGrade!");
    }

}
